package com.glasses.business.fragment;

import android.os.Bundle;
import android.support.v4.view.ViewPager;

import com.glasses.business.base.BaseViewPagerFragment_Smart_Normal;
import com.glasses.business.event.BussEvent;

import net.neiquan.applibrary.utils.SmartItem;

import org.haitao.common.utils.AppLog;

import java.util.ArrayList;
import java.util.List;

import de.greenrobot.event.EventBus;

/**
 * Author：邓勇军
 * English Name：Deng,The Sky Fucker!
 * Email：dandycoder@126.com
 * Date：2017/3/7
 * Version：1.0
 */

public class MyOrderFragment extends BaseViewPagerFragment_Smart_Normal {
    @Override
    public boolean isHaveHead() {
        return true;
    }

    @Override
    public List<SmartItem> getSmartItems() {
        List<SmartItem> smartItems = new ArrayList<>();
        Bundle bundle1 = new Bundle();
        bundle1.putInt("status", 0);
        smartItems.add(new SmartItem("全部", OrderListFragment.class, bundle1));
        Bundle bundle2 = new Bundle();
        bundle2.putInt("status", 1);
        smartItems.add(new SmartItem("待付款", OrderListFragment.class, bundle2));
        Bundle bundle3 = new Bundle();
        bundle3.putInt("status", 2);
        smartItems.add(new SmartItem("待收货", OrderListFragment.class, bundle3));
        Bundle bundle4 = new Bundle();
        bundle4.putInt("status", 3);
        smartItems.add(new SmartItem("已完成", OrderListFragment.class, bundle4));
        Bundle bundle5 = new Bundle();
        bundle5.putInt("status", 4);
        smartItems.add(new SmartItem("售后", OrderListFragment.class, bundle5));
        return smartItems;
    }

    @Override
    public void initData() {
        setTitleTv("我的订单");
        mViewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
            @Override
            public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {

            }

            @Override
            public void onPageSelected(int position) {
                AppLog.e("===============onPageSelected=================");
                EventBus.getDefault().post(new BussEvent(BussEvent.Order_Refush));
            }

            @Override
            public void onPageScrollStateChanged(int state) {

            }
        });
    }

    @Override
    public boolean mainTabShow() {
        return false;
    }
}
